<!DOCTYPE html>












  


<html class="theme-next pisces use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
























<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2">

<link rel="stylesheet" href="/css/main.css?v=7.1.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.1.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/logo1.jpg?v=7.1.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/logo1.jpg?v=7.1.0">


  <link rel="mask-icon" href="/images/logo.svg?v=7.1.0" color="#222">







<script id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '7.1.0',
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false,"dimmer":false},
    back2top: true,
    back2top_sidebar: false,
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="引用变量到底占不占用内存空间，一直存在着很多争议。">
<meta name="keywords" content="C++">
<meta property="og:type" content="article">
<meta property="og:title" content="引用类型详解">
<meta property="og:url" content="https://luoo.oschina.io/2016/10/09/tech/引用类型详解/index.html">
<meta property="og:site_name" content="从你的全世界路过">
<meta property="og:description" content="引用变量到底占不占用内存空间，一直存在着很多争议。">
<meta property="og:locale" content="zh-CN">
<meta property="og:updated_time" content="2019-04-14T12:28:00.740Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="引用类型详解">
<meta name="twitter:description" content="引用变量到底占不占用内存空间，一直存在着很多争议。">



  <link rel="alternate" href="/atom.xml" title="从你的全世界路过" type="application/atom+xml">



  
  
  <link rel="canonical" href="https://luoo.oschina.io/2016/10/09/tech/引用类型详解/">



<script id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>引用类型详解 | 从你的全世界路过</title>
  












  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">从你的全世界路过</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">心智渐开，世事渐杂</p>
      
    
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">

    
    
    
      
    

    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">

    
    
    
      
    

    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">

    
    
    
      
    

    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">

    
    
    
      
    

    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-schedule">

    
    
    
      
    

    

    <a href="/schedule/" rel="section"><i class="menu-item-icon fa fa-fw fa-calendar"></i> <br>计划</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-you">

    
    
    
      
    

    

    <a href="/you/" rel="section"><i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br>知遇</a>

  </li>
        
        
        
          
          <li class="menu-item menu-item-about">

    
    
    
      
    

    

    <a href="/about/" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>

  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://luoo.oschina.io/2016/10/09/tech/引用类型详解/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="方林">
      <meta itemprop="description" content="愿你出走半生，归来仍是少年">
      <meta itemprop="image" content="/images/logo1.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="从你的全世界路过">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">引用类型详解

              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2016-10-09 23:16:25" itemprop="dateCreated datePublished" datetime="2016-10-09T23:16:25+08:00">2016-10-09</time>
            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/编程技术/" itemprop="url" rel="index"><span itemprop="name">编程技术</span></a></span>

                
                
              
            </span>
          

          
            
            
              
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
            
                <span class="post-meta-item-text">评论数：</span>
                <a href="/2016/10/09/tech/引用类型详解/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/2016/10/09/tech/引用类型详解/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>引用变量到底占不占用内存空间，一直存在着很多争议。</p>
<a id="more"></a>
<p>引用不占空间的说法是流传很广的误会…… 造成该误会的原因可能有：</p>
<h1 id="自动变量优化"><a href="#自动变量优化" class="headerlink" title="自动变量优化"></a>自动变量优化</h1><p>int是否占用空间？这个不好说， 但int能sizeof， 能用 &amp; 取到地址(非register)是肯定的。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">int f(int x, int y) &#123;</span><br><span class="line">	int xx = x*x;</span><br><span class="line">	int yy = y*y;</span><br><span class="line">	int a = xx + yy;</span><br><span class="line">	return a;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>xx,yy,a是否占空间？  优化开高了也许就不占了， 直接寄存器干活。<br>x/y是否占空间？ 至少i386上 cdecl 调用约定是占的。</p>
<h1 id="无法取得变量本身的地址"><a href="#无法取得变量本身的地址" class="headerlink" title="无法取得变量本身的地址"></a>无法取得变量本身的地址</h1><p>sizeof得到的是被引用对象的大小， &amp; 得到的是被引用对象的地址。因为引用语意的关系， 没办法”直接”获得引用变量本身的大小与地址信息可能也造成了该误会……<br>类似Windows下的dll导入机制：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">__declspec(dllimport) double x;</span><br></pre></td></tr></table></figure>
<p>实际上类似这样的代码</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">extern double* __imp_x;</span><br><span class="line">#define x (*__imp_x);</span><br></pre></td></tr></table></figure>
<p>通过x宏， 没法取得 __imp_x 的大小与地址。<br>C++没有规定引用如何实现。 但在i386上， cl/gcc/clang实现都类似这样。</p>
<h1 id="绕过语法糖干扰"><a href="#绕过语法糖干扰" class="headerlink" title="绕过语法糖干扰"></a>绕过语法糖干扰</h1><p>最简单的方法：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">struct X &#123; double&amp; d; &#125;;</span><br><span class="line">enum &#123; size = sizeof(X) &#125;; // 该平台上引用大小</span><br><span class="line"></span><br><span class="line">double d;</span><br><span class="line">X x = &#123; d &#125;;</span><br><span class="line">void* address = &amp;x; // 引用变量的地址</span><br><span class="line"></span><br><span class="line">unsigned char representation[sizeof(X)];</span><br><span class="line">memcpy(representation, address, sizeof x); // 可查看引用变量的表示</span><br></pre></td></tr></table></figure>
<p>其他还有很多方法阻止编译器优化， 比如参数， 静态变量…… 不过都比结构体复杂。</p>
<h1 id="让我们看一个小程序"><a href="#让我们看一个小程序" class="headerlink" title="让我们看一个小程序"></a>让我们看一个小程序</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line">#include &lt;iostream&gt;</span><br><span class="line">using namespace std;</span><br><span class="line"></span><br><span class="line">int x = 9;</span><br><span class="line">struct A</span><br><span class="line">&#123;</span><br><span class="line">	int a = 5;</span><br><span class="line">	int &amp;b = x;</span><br><span class="line">	int *c = &amp;a;</span><br><span class="line">&#125;;</span><br><span class="line"></span><br><span class="line">int main()</span><br><span class="line">&#123;</span><br><span class="line">	A a;</span><br><span class="line">	cout &lt;&lt; sizeof A &lt;&lt; endl;</span><br><span class="line">	cout &lt;&lt; hex &lt;&lt; &amp;x &lt;&lt; endl;</span><br><span class="line">	cout &lt;&lt; hex &lt;&lt; &amp;a.a &lt;&lt; endl;</span><br><span class="line">	cout &lt;&lt; hex &lt;&lt; &amp;a.b &lt;&lt; endl;</span><br><span class="line">	cout &lt;&lt; hex &lt;&lt; &amp;a.c &lt;&lt; endl;</span><br><span class="line"></span><br><span class="line">	int *p = &amp;a.a;</span><br><span class="line">	cout &lt;&lt; oct &lt;&lt; *p &lt;&lt; endl;</span><br><span class="line">	p++;</span><br><span class="line">	cout &lt;&lt; hex &lt;&lt; *p &lt;&lt; endl;</span><br><span class="line">	p++;</span><br><span class="line">	cout &lt;&lt; hex &lt;&lt; *p &lt;&lt; endl;</span><br><span class="line"></span><br><span class="line">	getchar();</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">输出：</span><br><span class="line">12</span><br><span class="line">00EFA000</span><br><span class="line">0037FB6C</span><br><span class="line">00EFA000</span><br><span class="line">0037FB74</span><br><span class="line">5</span><br><span class="line">efa000</span><br><span class="line">37fb6c</span><br></pre></td></tr></table></figure>
<p>可以看到引用变量是真实的占用着空间的，这个空间里面存储的内容是被引用变量的地址。</p>
<h1 id="向更底层求证"><a href="#向更底层求证" class="headerlink" title="向更底层求证"></a>向更底层求证</h1><p>有如下代码</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">#include&lt;stdio.h&gt;</span><br><span class="line">void main()</span><br><span class="line">&#123;</span><br><span class="line">	int a=1;</span><br><span class="line">	int &amp;b=a;</span><br><span class="line">	int *p=&amp;a;</span><br><span class="line">	int *q=&amp;b;</span><br><span class="line">	printf(&quot;%d %d&quot;,p, q);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>反汇编后</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">4:			int a=1;</span><br><span class="line">00401028	mov			dword ptr [ebp-4],1</span><br><span class="line">5:			int &amp;b=a;</span><br><span class="line">0040102f	lea			eax,[ebp-4]</span><br><span class="line">00401032	mov			dword ptr [ebp-8],eax</span><br><span class="line">6:			int *p=&amp;a;</span><br><span class="line">00401035	lea			ecx,[ebp-4]</span><br><span class="line">00401038	mov			dword ptr [ebp-0ch],ecx</span><br><span class="line">7:			int *q=&amp;b;</span><br><span class="line">0040103b	mov			edx,dword ptr [ebp-8]</span><br><span class="line">0040103e	mov			dword ptr [ebp-10h],edx</span><br><span class="line">8:			printf(&quot;%d %d&quot;,p,q);</span><br></pre></td></tr></table></figure>
<p>通过查看反汇编代码会发现<br>1.编译器为引用变量b分配了四个字节的空间dword ptr [ebp-8]<br>2.这四个字节存放的是变量a的地址<br>3.当对变量a与引用变量b使用&amp;时编译器对此符号做出了不同的解释<br>4.不同之处是在对引用变量b做&amp;时编译器并没有把它解释为取b的地址，而是解释为取b的内容（b中存放的是a的地址）<br>现在我相信你不用运行这段代码就已经知道结果了<br>那你是不是还是疑惑，还是想知道个为什么？<br>为什么对引用变量取地址得到的是被引用变量的地址？？<br>没有什么为什么？<br>如果你真的想知道为什么我不介意在这误人子弟一下，，，，，<br>下面我们在来看一下百度百科对引用的关键介绍——-“引用就是某一变量（目标）的一个别名，对引用的操作与对变量直接操作完全一样”<br>看到没？？？？<br>“引用就是某一变量（目标）的一个别名，对引用的操作与对变量直接操作完全一样“<br>C++编译器就是为了符合这句话，也就是说C++编译器对引用的支持是根据这句话设计的，c++编译器必须要保证”对引用的操作与对变量直接操作完全一样“。。。。。。。</p>
<h1 id="小结"><a href="#小结" class="headerlink" title="小结"></a>小结</h1><p>引用引入了对象的一个同义词。定义引用的表示方法与定义指针相似，只是用&amp;代替了*。引用（reference）是c++对c语言的重要扩充。<br>引用就是某一变量（目标）的一个别名，对引用的操作与对变量直接操作完全一样。引用的声明方法：类型标识符 &amp;引用名=目标变量名；</p>
<ol>
<li>&amp;在此不是求地址运算，而是起标识作用。</li>
<li>类型标识符是指目标变量的类型。</li>
<li>声明引用时，必须同时对其进行初始化。</li>
<li>引用声明完毕后，相当于目标变量名有两个名称，即该目标原名称和引用名，且不能再把该引用名作为其他变量名的别名。</li>
</ol>
<p>C++ （印象中）没有详细描述引用变量的实现方式。但在 i386(cl/gcc/clang) 下， 引用 —— 如同 int —— 是有大小的， 可以用 3 的方式得到自动变量的空间（无论是否是引用）都有可能被优化。</p>

      
    </div>

    

    
    
    

    

    
      
    
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/C/" rel="tag"># C++</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/10/04/travel/大洪山/" rel="next" title="大洪山">
                <i class="fa fa-chevron-left"></i> 大洪山
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/12/02/tech/容器快速入门/" rel="prev" title="容器快速入门">
                容器快速入门 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  
    <div class="comments" id="comments">
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/logo1.jpg" alt="方林">
            
              <p class="site-author-name" itemprop="name">方林</p>
              <div class="site-description motion-element" itemprop="description">愿你出走半生，归来仍是少年</div>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">27</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  
                    
                      <a href="/categories/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">3</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                      <a href="/tags/">
                    
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">17</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          

          
            <div class="links-of-author motion-element">
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="https://github.com/yourname" title="GitHub &rarr; https://github.com/yourname" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>
              
                <span class="links-of-author-item">
                  
                  
                    
                  
                  
                    
                  
                  <a href="mailto:sean_ps@163.com" title="E-Mail &rarr; mailto:sean_ps@163.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                </span>
              
            </div>
          

          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                Links
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="http://www.luoo.net" title="http://www.luoo.net" rel="noopener" target="_blank">落网</a>
                  </li>
                
              </ul>
            </div>
          

          
            
          
          

        </div>
      </div>

      
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#自动变量优化"><span class="nav-number">1.</span> <span class="nav-text">自动变量优化</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#无法取得变量本身的地址"><span class="nav-number">2.</span> <span class="nav-text">无法取得变量本身的地址</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#绕过语法糖干扰"><span class="nav-number">3.</span> <span class="nav-text">绕过语法糖干扰</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#让我们看一个小程序"><span class="nav-number">4.</span> <span class="nav-text">让我们看一个小程序</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#向更底层求证"><span class="nav-number">5.</span> <span class="nav-text">向更底层求证</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#小结"><span class="nav-number">6.</span> <span class="nav-text">小结</span></a></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      

      

    </div>
  </aside>
  


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">fanglin</span>

  

  
</div>









        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

    

    
  </div>

  

<script>
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  <script src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>


  


  <script src="/js/utils.js?v=7.1.0"></script>

  <script src="/js/motion.js?v=7.1.0"></script>



  
  


  <script src="/js/affix.js?v=7.1.0"></script>

  <script src="/js/schemes/pisces.js?v=7.1.0"></script>



  
  <script src="/js/scrollspy.js?v=7.1.0"></script>
<script src="/js/post-details.js?v=7.1.0"></script>



  


  <script src="/js/next-boot.js?v=7.1.0"></script>


  

  

  

  
  

<script src="//cdn1.lncld.net/static/js/3.11.1/av-min.js"></script>



<script src="//unpkg.com/valine/dist/Valine.min.js"></script>

<script>
  var GUEST = ['nick', 'mail', 'link'];
  var guest = 'nick,mail,link';
  guest = guest.split(',').filter(function(item) {
    return GUEST.indexOf(item) > -1;
  });
  new Valine({
    el: '#comments',
    verify: true,
    notify: false,
    appId: 'jjdDCzDO6jlN5yOgAbnVwdJ3-gzGzoHsz',
    appKey: 'jnjP7aorboCG7pJV6HvdMP15',
    placeholder: 'ヾﾉ≧∀≦)o来啊，快活啊!',
    avatar: 'mm',
    meta: guest,
    pageSize: '10' || 10,
    visitor: false,
    lang: 'zh-cn' || 'zh-cn'
  });
</script>




  


  




  

  

  

  

  

  

  

  

  

  

  

  

  

  

</body>
</html>
